/*
 * This file is part of JContextFree.
 *
 * JContextFree is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JContextFree is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JContextFree.  If not, see <http://www.gnu.org/licenses/>.
 */

package it.enricod.jcontextfree.gui.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import it.enricod.jcontextfree.gui.IProgramsTabbedPane;
import it.enricod.jcontextfree.model.IProgramPM;

import javax.swing.JTabbedPane;

public class ProgramsTabbedPane implements IProgramsTabbedPane {

	private JTabbedPane tabbedPane;
	private Map<String, IProgramPM> openedPrograms = new HashMap<String, IProgramPM>();

	public ProgramsTabbedPane() {
		initGui();
	}

	private void initGui() {
		tabbedPane = new JTabbedPane();
	}

	public JTabbedPane getTabbedPane() {
		return tabbedPane;
	}

	public void addProgramTab(IProgramPM program) {
		if ( openedPrograms.containsKey(program.getName())) {
			return;
		}
		ProgramPane programPane = new ProgramPane();
		tabbedPane.addTab(program.getName(), programPane.getComponent() );
		programPane.drawProgram(program.getProgram());
	}

}
